package cn.org.channl.server.action;


import cn.org.channl.message.Message;
import cn.org.channl.exception.ValidateCKException;
import io.netty.channel.ChannelHandlerContext;
import lombok.AllArgsConstructor;

@AllArgsConstructor
public abstract class ChannelActionAdapter {
	protected ChannelHandlerContext channelHandlerContext;
	
	protected Message message;

	/*public ChannelAction(ChannelHandlerContext channelHandlerContext, Message message) {
		super();
		this.channelHandlerContext = channelHandlerContext;
		this.message = message;
	}*/

	/*ValidateCKException这个异常不在这里处理,直接抛给netty处理,在BusinessHandler的exceptionCaught方法做处理*/
	public final void execute(){
		ckValidate();
		doExecute();
	}

	public abstract void doExecute();

	private void ckValidate() throws ValidateCKException {
		//验证
		
		//不符合验证
		//ValidateCKException validateCKException = new ValidateCKException();
		//validateCKException.setChannel(channelHandlerContext.channel());
		//validateCKException.setMsg(message);
		//throw validateCKException;
	}
	
}
